/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author HenryHieuPham
 */
@Entity
public class AnalyticsEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    private String chartType;
    private String description;
    private boolean forStakeholder;
    @ManyToOne
    private MetricTypeEntity metricType;
    @ManyToMany(mappedBy="analytic")
    private List<ServicePackageEntity> servicePackage = new ArrayList<ServicePackageEntity>();
    
    @OneToMany (mappedBy = "analytics")
    private List<ChosenMetricEntity> chosenMetrics = new ArrayList<ChosenMetricEntity>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AnalyticsEntity)) {
            return false;
        }
        AnalyticsEntity other = (AnalyticsEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.AnalyticsEntity[ id=" + id + " ]";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getChartType() {
        return chartType;
    }

    public void setChartType(String chartType) {
        this.chartType = chartType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<ChosenMetricEntity> getChosenMetrics() {
        return chosenMetrics;
    }

    public void setChosenMetrics(List<ChosenMetricEntity> chosenMetrics) {
        this.chosenMetrics = chosenMetrics;
    }

    public MetricTypeEntity getMetricType() {
        return metricType;
    }

    public void setMetricType(MetricTypeEntity metricType) {
        this.metricType = metricType;
    }

    public List<ServicePackageEntity> getServicePackage() {
        return servicePackage;
    }

    public void setServicePackage(List<ServicePackageEntity> servicePackage) {
        this.servicePackage = servicePackage;
    }

    public boolean isForStakeholder() {
        return forStakeholder;
    }

    public void setForStakeholder(boolean forStakeholder) {
        this.forStakeholder = forStakeholder;
    }
    
}
